# -*- coding: utf-8 -*-

################################################################################
## Form generated from reading UI file '自定义等待提示框.ui'
##
## Created by: Qt User Interface Compiler version 5.15.2
##
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################

from PySide2.QtCore import *
from PySide2.QtGui import *
from PySide2.QtWidgets import *
from PySide2 import QtWidgets, QtCore, QtGui
import sys


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        if not MainWindow.objectName():
            MainWindow.setObjectName(u"MainWindow")
        MainWindow.resize(800, 600)
        self.centralwidget = QWidget(MainWindow)
        self.centralwidget.setObjectName(u"centralwidget")

        self.loading = QtWidgets.QLabel(self.centralwidget)
        self.loading.setObjectName(u"loading")
        self.loading.setGeometry(QRect(270, 170, 221, 131))
        self.loading.setAlignment(Qt.AlignCenter)
        self.loading.setStyleSheet("")
        self.loading.setText("")

        self.pushButton = QPushButton(self.centralwidget)
        self.pushButton.setObjectName(u"pushButton")
        self.pushButton.setGeometry(QRect(170, 360, 131, 41))

        self.pushButton_2 = QPushButton(self.centralwidget)
        self.pushButton_2.setObjectName(u"pushButton_2")
        self.pushButton_2.setGeometry(QRect(470, 360, 121, 41))

        MainWindow.setCentralWidget(self.centralwidget)
        self.menubar = QMenuBar(MainWindow)
        self.menubar.setObjectName(u"menubar")
        self.menubar.setGeometry(QRect(0, 0, 800, 26))
        MainWindow.setMenuBar(self.menubar)
        self.statusbar = QStatusBar(MainWindow)
        self.statusbar.setObjectName(u"statusbar")
        MainWindow.setStatusBar(self.statusbar)

        self.retranslateUi(MainWindow)

        QMetaObject.connectSlotsByName(MainWindow)

        # 设置两个按钮的信号与槽
        self.pushButton.clicked.connect(self.start_loading)
        self.pushButton_2.clicked.connect(self.stop_loading)

    # setupUi

    def retranslateUi(self, MainWindow):
        MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"\u8bbe\u7f6e\u81ea\u5b9a\u4e49\u7b49\u5f85\u63d0\u793a\u6846", None))

        self.pushButton.setText(QCoreApplication.translate("MainWindow", u"\u542f\u52a8\u7b49\u5f85\u63d0\u793a", None))
        self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"\u505c\u6b62\u7b49\u5f85\u63d0\u793a", None))

    # 定义开始加载槽函数
    def start_loading(self):
        self.gif = QtGui.QMovie('等待动图.gif')     # 加载动图
        self.loading.setMovie(self.gif)            # 为开始的加载label添加动图
        self.gif.start()

    def stop_loading(self):
        self.gif.stop()
        self.loading.clear()


if __name__ == '__main__':
    app = QtWidgets.QApplication(sys.argv)
    MainWindow = QtWidgets.QMainWindow()
    ui = Ui_MainWindow()
    ui.setupUi(MainWindow)
    MainWindow.show()
    sys.exit(app.exec_())




